/**
*      author: Y_Yao
*      created: 2025-02-20 20:53:41
**/

#include<bits/stdc++.h>

#define int LL
using namespace std;
using LL = long long;
const LL LLINF = 1e18;
const int INF = 0x3f3f3f3f;
int n;
vector<string> ans;

void dfs(string cur,int len)
{
    if(len == n)
    {
        ans.push_back(cur);
        return;
    }

    dfs(cur + 'a',len + 1);
    dfs(cur + 'b',len + 1);
    dfs(cur + 'c',len + 1);
}

void solve()
{
    cin >> n;
    string s;
    dfs(s,0);
    for(auto& e : ans)
    {
        cout << e << endl;
    }
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    //cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}
